<?php

 
Zend_Loader::loadClass("BaseDBRows");
Zend_Loader::loadClass("StaffSkill");
class StaffSkills extends BaseDBRows
{
	protected function setUp()
	{
		$this->_tableName = StaffSkill::_tablename;
	}	
	
	public function getSkillsByStaff($staffId) {
	
		Zend_Loader::loadClass("Skill");
		Zend_Loader::loadClass("QueryCreator");
		
		$query = new QueryCreator();
		$query->addSelect("ss.staff_skills_id, s.skill, ss.level, ss.date_acquired, ss.remarks");
		$query->addFrom($this->_tableName . " ss ");
		$query->addJoin(", " . Skill::_tablename . " s ");
		$query->addWhere("ss.skill_id = s.skill_id");
		$query->addWhere("ss.staff_id = " . $staffId);
		$query->addOrderBy("ss.date_acquired desc");
		
		$db = DBCon::instance();
		$result = $db->executeQuery($query->createSQL());
		return $result;
		
	}
	
	public function getSkillsByStaffSkill($staffSkillId) {
	
		Zend_Loader::loadClass("Skill");
		Zend_Loader::loadClass("QueryCreator");
		
		// echo  '1' ;die();
		$query = new QueryCreator();
		$query->addSelect(" ss.*, s.skill ");
		$query->addFrom($this->_tableName . " ss ");
		$query->addJoin(", " . Skill::_tablename . " s ");
		$query->addWhere("ss.skill_id = s.skill_id");
		$query->addWhere("ss.staff_skills_id = " . $staffSkillId);
		
		$db = DBCon::instance();
		//echo  $query->createSQL();die();
		$result = $db->executeQuery($query->createSQL());
		return $result;
		
	}
	
	
}
?>